package org.feng.demo;

import org.feng.framework.ApplicationContext;
import org.feng.framework.DefaultAnnotationApplicationContext;

import java.io.IOException;

/**
 * 启动类
 *
 * @version v1.0
 * @author: fengjinsong
 * @date: 2022年04月09日 14时51分
 */
public class Test {
    public static void main(String[] args) throws Exception {
        // 启动容器
        ApplicationContext applicationContext = new DefaultAnnotationApplicationContext(AppConfig.class);

        // 从容器中获取实例
        UserService userService = applicationContext.getBean("userService", UserService.class);
        UserService userService1 = applicationContext.getBean("userService", UserService.class);

        UserService userService2 = applicationContext.getBean("userService", UserService.class);

        UserService userService3 = applicationContext.getBean("userService", UserService.class);

        System.out.println(userService);
        System.out.println(userService1);
        System.out.println(userService2);
        System.out.println(userService3);
    }
}
